﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Enterprise.DataFactory;

namespace Enterprise.Data.Kaifabu
{
    public class ChanliangData
    {
        /// <summary>
        /// 获取数据列表
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public System.Data.DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select YEAR,MONTH,DWMC,CL ");
            strSql.Append(" FROM KFB_CHANLIANG ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbExecute.GetDataSet(strSql.ToString());
        }

        /// <summary>
        /// 创建空表
        /// </summary>
        /// <param name="ny"></param>
        /// <param name="dw"></param>
        public void Create(int year,string dw)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("begin ");
            for (int i = 1; i <= 12; i++)
            {
                sb.Append("Insert into kfb_chanliang (YEAR,MONTH,DWMC,CL) values(" + year + "," + i + ",'" + dw + "',null);");
            }
            sb.Append("null;end;");
            DbExecute.Execute(sb.ToString());
        }
    }
}
